package com.xdf.ecommerce.converter;

import com.xdf.ecommerce.constant.GoodsCategory;

import javax.persistence.AttributeConverter;

/**
 * @author chanchaw
 * @create 2025-10-27 19:44
 */
public class GoodsCategoryConverter implements AttributeConverter<GoodsCategory,Integer> {
    @Override
    public Integer convertToDatabaseColumn(GoodsCategory goodsCategory) {
        return goodsCategory.getId();
    }

    @Override
    public GoodsCategory convertToEntityAttribute(Integer integer) {
        return GoodsCategory.of(integer);
    }
}
